package com.mashiguang.po;

import java.util.List;
import java.util.Set;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.OneToMany;
import javax.persistence.Table;

@Entity
@Table(name="authorities")
public class Authority {

	@Id
	private Integer id;
	
	@Column(name="authority")
	private String authority;

	@OneToMany
	@JoinTable(name="group_authorities",
			joinColumns=@JoinColumn(name="authority_id"),
			inverseJoinColumns=@JoinColumn(name="group_id"))
	private List<Group> groups;
	
	@OneToMany
	@JoinTable(name="authorities_resource",
			joinColumns=@JoinColumn(name="authorities_id"),
			inverseJoinColumns=@JoinColumn(name="resource_id"))
	private List<Resource> resources;
	
	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public String getAuthority() {
		return authority;
	}

	public void setAuthority(String authority) {
		this.authority = authority;
	}

	public List<Group> getGroups() {
		return groups;
	}

	public void setGroups(List<Group> groups) {
		this.groups = groups;
	}

	public List<Resource> getResources() {
		return resources;
	}

	public void setResources(List<Resource> resources) {
		this.resources = resources;
	}

}
